package com.oj.judge.service.impl;

import java.util.List;
import com.oj.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.oj.judge.mapper.OjSubmissionMapper;
import com.oj.judge.domain.OjSubmission;
import com.oj.judge.service.IOjSubmissionService;

/**
 * 测评状态Service业务层处理
 * 
 * @author xxx
 * @date 2025-03-16
 */
@Service
public class OjSubmissionServiceImpl implements IOjSubmissionService 
{
    @Autowired
    private OjSubmissionMapper ojSubmissionMapper;

    /**
     * 查询测评状态
     * 
     * @param id 测评状态主键
     * @return 测评状态
     */
    @Override
    public OjSubmission selectOjSubmissionById(Long id)
    {
        return ojSubmissionMapper.selectOjSubmissionById(id);
    }

    /**
     * 查询测评状态列表
     * 
     * @param ojSubmission 测评状态
     * @return 测评状态
     */
    @Override
    public List<OjSubmission> selectOjSubmissionList(OjSubmission ojSubmission)
    {
        return ojSubmissionMapper.selectOjSubmissionList(ojSubmission);
    }

    /**
     * 新增测评状态
     * 
     * @param ojSubmission 测评状态
     * @return 结果
     */
    @Override
    public int insertOjSubmission(OjSubmission ojSubmission)
    {
        ojSubmission.setCreateTime(DateUtils.getNowDate());
        return ojSubmissionMapper.insertOjSubmission(ojSubmission);
    }

    /**
     * 修改测评状态
     * 
     * @param ojSubmission 测评状态
     * @return 结果
     */
    @Override
    public int updateOjSubmission(OjSubmission ojSubmission)
    {
        ojSubmission.setUpdateTime(DateUtils.getNowDate());
        return ojSubmissionMapper.updateOjSubmission(ojSubmission);
    }

    /**
     * 批量删除测评状态
     * 
     * @param ids 需要删除的测评状态主键
     * @return 结果
     */
    @Override
    public int deleteOjSubmissionByIds(Long[] ids)
    {
        return ojSubmissionMapper.deleteOjSubmissionByIds(ids);
    }

    /**
     * 删除测评状态信息
     * 
     * @param id 测评状态主键
     * @return 结果
     */
    @Override
    public int deleteOjSubmissionById(Long id)
    {
        return ojSubmissionMapper.deleteOjSubmissionById(id);
    }
}
